package luogu.rookie;

import java.util.Scanner;

public class P1179_数字统计 {

    //数字统计

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 0;

        for (int i = a; i <= b; i++) {
            int n = i;
            while (n != 0){
                if (n % 10 == 2){
                    sum++;
                }
            n /= 10;
            }
        }
        System.out.println(sum);

    }





}
